{extend name="public/common"/}
{block name="head"}

{/block}

{block name="banner"}

<div class="banner">
    <div class="wrapper">
        <div class="txt">
            {$category.title}
        </div>
    </div>
</div>
{/block}
{block name="body"}
{include file="document/nav"/}

<div class="wrapper notices">
    <div class="notices-bd" style="min-height:300px">
        <form>
            <input type="hidden" name="page" id="page" value="1">
            <ul id="lists">
                {Cms:document name="document" category_id="$category['id']" row="6"}
                <li>
                    <div class="hd">
                        <a href="{:url('cms/Document/detail?category_id='.$document['category_id'],['id'=>$document['id']])}"title="{$document.title}">{$document.title}</a>
                    </div>
                    <div class="bd">
                    </div>
                    <div class="ft">
                        <div class="ft-l">
                            <span>{$document.create_time}</span>
                        </div>
                        <div class="ft-r">
                            发布：{:config('setting.web_site_title')}
                        </div>
                    </div>
                </li>
                {/Cms:document}
            </ul>
    </div>
    <!---->
    <div class="notices-ft" id="getmore">
        <a class="g-btn" href="javascript:;">加载更多</a>
    </div>
    <!---->
</div>
{/block}


{block name="script"}

<script type="text/javascript">
    $("#getmore").click(function(){
        var page = $("#page").val();
        $.ajax({
            type: "get",
            dataType: "json",
            url: "{:url('cms/Document/lists?category_id='.$category['id'])}",
            data: {pageCurrent:parseInt(page) + 1,more:1},
            success: function(result) {
                if(0 == result.code && result.data.data.length>0) {
                    var str = "";
                    $.each(result.data.data,function(index,array){
                        if (array['id']){
                            str += '<li>';
                            str += '<div class="hd">';
                            str += '<a href="{:url('cms/Document/detail',[],false,false)}/'+array['id']+'.html">'+array['title']+'</a>';
                            str += '</div>';
                            str += '<div class="bd">'+ array['description']+'</div>';
                            str += '<div class="ft">';
                            str += '<span>'+array['create_time']+'</span>';
                            str += '</div><div class="ft-r"> 发布：{:config('setting.web_site_title')}</div></div></li>';
                        }
                    });
                    $("#lists").append(str);
                    if (result.data.current_page >= result.data.last_page)
                    {
                        $("#getmore").html("没有更多内容了..");
                    }
                    $("#page").val(result.data.current_page);
                } else {
                    $("#getmore").html("没有更多内容了..");
                }
            }
        });
    });
</script>

{/block}
